<template>
  <div>
    <div class="myart1">
      <collect-item v-for="item in allData" :key="item.comment_id" v-bind="item"  @call-get-collect="load"/>
      <el-empty
          v-if="allData.length == 0"
          :image-size="250"
          description="暂未收藏任何书评"
      ></el-empty>
    </div>
  </div>
</template>

<script>
import collectItem from "@/components/admin/collectItem.vue";

export default {
  name: "mycollect",
  components: {collectItem},
  data() {
    return {
      allData:[],
      avatar: String,
      account: String,
      age: String,
      email: String,
      mobilePhoneNumber: String,
      area: String,
      createDate: String,
      nickname: String,
      sex: String,
      work: String,
      hobby: String,
      design: String,
    };
  },
  mounted() {
    this.load();
  },
  methods: {
    load(){
      this.$axios
          .post('/getCollects', {
            authorId: window.localStorage.getItem('userId'),
          })
          .then(res=>{
            this.allData = res.data
            console.log(this.allData)
          })
    },
    delCollect(id){
      this.dialogVisible = false
      this.$axios
          .post('/delComment', {
            commentId: id,
          })
          .then(res=>{
            console.log(res)
            this.$emit('call-get-comment');
          })
    }
  },
};
</script>

<style scoped>
.img {
  width: 80px;
  height: 80px;
}
.el-card {
  margin-bottom: 30px;
}
</style>